import axios from 'axios';
import * as contants from './constants';

const changeDeail=(title,content)=>({
    type:contants.CHANGE_DETAIL,
    title,
    content
})
export const getDetail=(id)=>{
    return (dispatch)=>{
        axios.get('/api/detail.json?id='+id).then((res)=>{
            const result=res.data.data;
            dispatch(changeDeail(result.title,result.content))
        })
    }
};